using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Contracts.Contracts;
using Simple.Contracts.Models;
using Simple.Contracts.Models.Common;
using Simple.WebAi.Authorizes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Simple.WebAi.Controllers
{
    /// <summary>
    /// 省市区控制器
    /// </summary>
    [Route("api/sys-places")]
    [ApiController]
    public class SysPlacesController : ControllerBase
    {
        private readonly ISysPlacesService _sysPlacesService;

        /// <summary>
        /// 依赖注入
        /// </summary>
        /// <param name="sysPlacesService">省市区服务</param>
        public SysPlacesController(ISysPlacesService sysPlacesService)
        {
            _sysPlacesService = sysPlacesService;
        }

        /// <summary>
        /// 获取省市区列表
        /// </summary>
        /// <param name="input">获取省市区列表输入参数</param>
        /// <returns>省市区列表</returns>
        [HttpPost("list")]
        [AccountAuthorize]
        public async Task<Result<List<SysPlacesDto>>> GetList(SysPlacesListInput input)
        {
            return await _sysPlacesService.GetList(input);
        }
    }
}